package com.guigui.gulimall.order.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Data
public class OrderConfirmVo {

    private List<CartItem> cartItems;

    private List<OrderAddressVo> address;

    /**
     * 积分
     */
    private Integer integration;

    private String token;

    public BigDecimal getTotalPrice() {
        BigDecimal price = new BigDecimal(0);
        for (CartItem cartItem : cartItems) {
            price = price.add(cartItem.getTotalPrice());
        }
        return price;
    }

    public Integer getTotalCount() {
        int count = 0;
        for (CartItem cartItem : cartItems) {
            count += cartItem.getCount();
        }
        return count;
    }

//    private BigDecimal payPrice;

}
